Revert "Hack up GPX writer to prepare for GGZ."
authorRobert Lipe <robertlipe@gpsbabel.org>
Wed, 6 Jan 2016 21:59:58 +0000 (15:59 -0600)
committerRobert Lipe <robertlipe@gpsbabel.org>
Wed, 6 Jan 2016 21:59:58 +0000 (15:59 -0600)
This reverts commit e529697c7247b0df99c94e05c73045efb2ed5999.

This was incomplete work for the new GGZ work that has the unfortunate
side effect of breaking our GPX writer for any GPX write over 500K.

Rolling this back for a probably respin of 1.5.3.

gpx.cc
gpx.h [deleted file]

diff --git a/gpx.cc b/gpx.cc
index e5fa054c1e8d32e676a97826a1d6b67e6eb8ad8e..67e10158d436f0a909585ce876ece9e8fbc34dca 100644 (file)
--- a/gpx.cc
+++ b/gpx.cc
 #include "cet_util.h"
 #include "garmin_fs.h"
 #include "garmin_tables.h"
-#include "gpx.h"
 #include "src/core/logging.h"
 #include "src/core/file.h"
 #include "src/core/xmlstreamwriter.h"
 #include "src/core/xmltag.h"
-#include "src/core/ziparchive.h"
 
 #include <QtCore/QXmlStreamReader>
 #include <QtCore/QRegExp>
@@ -64,12 +62,9 @@ static short_handle mkshort_handle;
 static QString link_url;
 static QString link_text;
 static QString link_type;
-static QString output_file_name;
-static QList<QString> gpx_files_written_;
 
 
 static char* snlen = NULL;
-static char* split = NULL;
 static char* suppresswhite = NULL;
 static char* urlbase = NULL;
 static route_head* trk_head;
@@ -1232,33 +1227,9 @@ gpx_rd_deinit(void)
   cur_tag = NULL;
 }
 
-// Secret accessor to return an array of file names that we have written.
-QList<QString> GetGpxFilesWritten() {
-  return gpx_files_written_;
-}
-
-// When we're writing multiple GPX files, get the output filename (which may
-// have a path component) in the current sequence.
-static QString GetOutFname(int seq) {
-  static const char* kNameToken = "__NUM__";
-
-  QString sequence = QString("%1").arg(seq);
-  QString s = output_file_name;
-  s.replace(kNameToken, sequence);
-  return s;
-}
-
 static void
-gpx_wr_init(const char* ifname)
+gpx_wr_init(const char* fname)
 {
-  QString fname = ifname;
-  if (output_file_name.isEmpty()) {
-    output_file_name = fname;
-    // Our first name is "one".
-    fname = GetOutFname(1);
-  }
-  gpx_files_written_.append(fname);
-
   mkshort_handle = NULL;
   oqfile = new gpsbabel::File(fname);
   oqfile->open(QIODevice::WriteOnly | QIODevice::Text);
@@ -1684,17 +1655,6 @@ gpx_waypt_pr(const Waypoint* waypointp)
   fs_xml* fs_gpx;
   garmin_fs_t* gmsd;   /* gARmIN sPECIAL dATA */
 
-  // If we're splitting files and the output buffer is approaching
-  // our split we close the file we were last writing and open a new
-  // one.
-  static const double kSplitPercent = 0.99;
-  if (oqfile->size() > atoi(split) * kSplitPercent) {
-    static int x = 2; // The first one is "one" automatically.
-    gpx_wr_deinit();
-    QString fn = GetOutFname(x++);
-    gpx_wr_init(CSTR(fn));
-  }
-
   writer->writeStartElement("wpt");
   writer->writeAttribute("lat", toString(waypointp->latitude));
   writer->writeAttribute("lon", toString(waypointp->longitude));
@@ -1969,10 +1929,6 @@ arglist_t gpx_args[] = {
     "snlen", &snlen, "Length of generated shortnames",
     "32", ARGTYPE_INT, "1", NULL, NULL
   },
-  {
-    "split", &split, "split wpts after this many bytes ",
-    "500000", ARGTYPE_INT, "1", NULL, NULL
-  },
   {
     "suppresswhite", &suppresswhite,
     "No whitespace in generated shortnames",
diff --git a/gpx.h b/gpx.h
deleted file mode 100644 (file)
index f61cef8..0000000
--- a/gpx.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-    Access GPX data files.
-
-    Copyright (C) 2002-2015 Robert Lipe, gpsbabel.org
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
-
- */
-QList<QString> GetGpxFilesWritten();